package com.hyh.admin.sys.controller.base;

import com.hyh.ad.common.core.controller.BaseController;
import com.hyh.ad.common.core.domain.AjaxResult;
import com.hyh.ad.common.core.domain.entity.SysOperLog;
import com.hyh.ad.common.core.page.TableDataInfo;
import com.hyh.admin.sys.service.ISysOperLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/api/sysOperLog")
@RestController
@Api(tags = "系统操作日志管理")
public class SysOperLogController  extends BaseController {
    @Autowired
    private ISysOperLogService sysOperLogService;

    /**
     * 查询操作日志列表
     * @return 日志列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "查询操作日志列表")
    public TableDataInfo listAllSelect(SysOperLog sysOperLog) {
        startPage();
        List<SysOperLog> sysOperLogs = sysOperLogService.listAllSelect(sysOperLog);
        return getDataTable(sysOperLogs);
    }

    /**
     * 删除操作日志
     * @param ids 操作日志
     * @return 结果
     */
    @DeleteMapping("/deleteByIds/{ids}")
    @ApiOperation(value = "删除操作日志 批量删除")
    public AjaxResult deleteByIds(@PathVariable Long[] ids) {
        return toAjax(sysOperLogService.deleteByIds(ids));
    }

    /**
     * 查询操作日志详细
     * @param id 操作日志
     * @return 结果
     */
    @GetMapping("/detail/{id}")
    @ApiOperation(value = "查询操作日志详细")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(sysOperLogService.detail(id));
    }
}
